package com.caesar.IoStream;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;

/**
 * @author caesar
 * @date 2025/7/14
 * @Description:
 * @apiNote
 */
public class exer3 {
    public static void main(String[] args)throws IOException {
        FileReader fr = new FileReader("C:\\Users\\caesar\\Desktop\\day14_IO流和异常完整资料\\day14_IO流和异常完整资料\\作业\\尚硅谷-第8章_File类与IO流_homework\\我想对你说.txt", Charset.forName("GBK"));
        FileWriter fw = new FileWriter("C:\\Users\\caesar\\Desktop\\day14_IO流和异常完整资料\\day14_IO流和异常完整资料\\作业\\尚硅谷-第8章_File类与IO流_homework\\柴老师的话.txt", Charset.forName("UTF-8"));
        char[] data = new char[1024];
        int len;
        while((len = fr.read(data))!=-1){
            fw.write(data, 0, len);
        }
        fw.close();
        fr.close();
    }
}
